package com.supplychain.scm.core.task.enums;

import com.supplychain.scm.core.basis.enums.IBaseEnum;
import com.supplychain.scm.core.basis.util.EnumUtils;
import lombok.AllArgsConstructor;

import java.util.Arrays;

/**
 * @author liyang
 * @version 1.0.0
 * @ClassName TaskTypeEnum
 * @Description 任务类型
 * @createTime 14:05:00 2023/03/31
 */
@AllArgsConstructor
public enum TaskTypeEnum implements IBaseEnum<String, String> {

	IMPORT_TASK("IMPORT","导入任务"),

	ASYNC_TASK("ASYNC","异步任务"),

	EXPORT_TASK("EXPORT","导出任务");

	private final String val;

	private final String desc;

	@Override
	public String getDescribe() {
		return this.desc;
	}

	@Override
	public String getValue() {
		return this.val;
	}

	public static TaskTypeEnum getTaskTypeEnum(String value){
		return Arrays.stream(TaskTypeEnum.values()).filter(typeEnum -> EnumUtils.eq(typeEnum, value)).findFirst().orElse(null);
	}
}
